package com.dxh.demo.controller;

import com.dxh.demo.service.IDemoService;
import com.dxh.edu.mvcframework.annotations.DxhAutowired;
import com.dxh.edu.mvcframework.annotations.DxhController;
import com.dxh.edu.mvcframework.annotations.DxhRequestMapping;
import com.dxh.edu.mvcframework.annotations.Security;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @Author: Dengxh
 * @Date: 2020/12/6 18:45
 * @Description:
 */
@DxhController
@DxhRequestMapping("/demo")
@Security(value = {"user1"})
public class DemoController {
    @DxhAutowired
    private IDemoService demoService;

    /**
     * URL:/demo/query
     */
    @DxhRequestMapping("/query")
    public String query(HttpServletRequest request, HttpServletResponse response, String username){
        return demoService.get(username);
    }

    @DxhRequestMapping("/query2")
    @Security(value = {"user2"})
    public String query2(HttpServletRequest request, HttpServletResponse response, String username){
        return demoService.get(username);
    }

    @DxhRequestMapping("/query3")
    @Security(value = {"user2","user1"})
    public String query3(HttpServletRequest request, HttpServletResponse response, String username){
        return demoService.get(username);
    }
}
